extends Control

@onready var buttons: Array[TextureButton] = [
	$"NinePatchRect/VBoxContainer/TextureButton",
	$"NinePatchRect/VBoxContainer/TextureButton2",
	$"NinePatchRect/VBoxContainer/TextureButton3"
]

var base_y := {}

func _ready():
	for btn in buttons:
		if btn == null:
			continue
		var label := btn.get_node("Label") as Label
		if label:
			label.mouse_filter = Control.MOUSE_FILTER_IGNORE
			base_y[label] = label.position.y
			btn.mouse_entered.connect(_on_btn_mouse_entered.bind(label))
			btn.mouse_exited.connect(_on_btn_mouse_exited.bind(label))

func _on_btn_mouse_entered(label: Label) -> void:
	var t := create_tween()
	t.tween_property(label, "position:y", float(base_y[label]) - 5.0, 0.08)\
		.set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)

func _on_btn_mouse_exited(label: Label) -> void:
	var t := create_tween()
	t.tween_property(label, "position:y", float(base_y[label]), 0.08)\
		.set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
		
func _on_texture_button_pressed() -> void:
	get_tree().change_scene_to_file("res://scene/chosenPage/chosenPage.tscn")


func _on_texture_button_2_pressed() -> void:
	pass # Replace with function body.


func _on_texture_button_3_pressed() -> void:
	pass # Replace with function body.
